<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const arr = ["a", "b", "c", "d", "e", "g"];
      console.log("删除前：", arr);
      // const r = arr.splice(1, 2); // 删除数组元素
      // const r = arr.splice(-4, 2); // 删除数组元素
      // const r = arr.splice(-4); // 删除数组元素
      // const r = arr.splice(-4, 0); // 删除数组元素
      const r = arr.splice(3, 1); // 删除数组元素
      console.log("删除后：", arr, r);
    </script>
  </body>
</html>
